﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Configuration;
using System.Collections.Generic;

namespace WebberCross.JavaScriptBridge.WebParts
{
    /// <summary>
    /// This is a base class for webpart user controls
    /// </summary>
    public class UserControlBase : UserControl
    {
        private WebPartBase _webPart = null;

        public WebPartBase WebPart
        {
            get { return this._webPart; }
            set { this._webPart = value; }
        }

        /// <summary>
        /// Gets a configuration setting from web.config
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        protected string GetConfigSetting(string key)
        {
            try
            {
                return ConfigurationManager.AppSettings[key];
            }
            catch { }

            return "Error reading key";
        }
    }
}
